package com.mengdie.shuidi.ui.adapter;

import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mengdie.shuidi.R;
import com.mengdie.shuidi.model.DiscountEntity;

import java.util.List;

/**
 * 作者：HQY on 2019/4/11 15:07
 * 邮箱：hqy_xz@126.com
 */
public class MyDiscountAdapter extends BaseQuickAdapter<DiscountEntity, BaseViewHolder> {


    public MyDiscountAdapter(List<DiscountEntity> data) {
        super(R.layout.item_my_discount, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, DiscountEntity item) {


        helper.setText(R.id.tv_discount_money, item.getMoney())
                .setText(R.id.tv_discount_name, item.getName())
                .setText(R.id.tv_discount_desc, item.getDes());
        TextView tvMoney = helper.getView(R.id.tv_discount_money);

        LinearLayout llBg = helper.getView(R.id.ll_discount_bg);
        if (item.getStatus() != -2) {
            llBg.setSelected(true);
            tvMoney.setSelected(true);
        } else {
            llBg.setSelected(false);
            tvMoney.setSelected(true);

        }

    }
}
